<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/index.css">
    <script src="js/vue.js"></script>
    <script src="js/elementui.js"></script>
    <script src="js/axios.js"></script>
    <script src="js/common.js"></script>
    <title>Document</title>
</head>
<style>
    body {
        margin: 0px;
    }

    #all-from {
        width: 30%;
        margin: 150px;
        background-color: #b6f4fa;
        border-radius: 10px;
        box-shadow: 0 0 10px #acd8fa;
        padding: 90px;
        text-align: center;
        margin-left: 450px;
    }
</style>
<body>
    <div id="app">
        <div id="all-from">
            <h2>新增用户</h2>
            <el-form ref="form" :model="form" label-width="80px">
                <el-form-item label="用户名">
                    <el-input v-model="form.uname"></el-input>
                </el-form-item>
                <el-form-item label="密码">
                    <el-input type="password" v-model="form.upwd"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="onSubmit">立即创建</el-button>
                </el-form-item>
            </el-form>
        </div>
    </div>
</body>
<script>
    new Vue({
        el: "#app",
        data: {
            form: {
                uname: '',
                upwd: ''
            }
        },
        methods: {
            onSubmit() {
                let that = this
                axios.post(API + "boot/insert", {
                    uname: that.form.uname,
                    upwd: that.form.upwd
                }).then(function (res) {
                    console.log(res)
                    if (res.data.code == 200) {
                        that.$message({
                            message:'添加成功',
                        })
                    }
                })
            }

        }
    })
</script>

</html>